home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2005 March
/
CMCD0305.ISO
/
Software
/
Shareware
/
Utilitare
/
emu
/
Emu8086_Setup_307c.exe
/
{app}
/
Samples
/
cmpsw.asm
< prev
next >
Wrap
Assembly Source File
|
2002-08-02
|
860b
|
52 lines
; This sample shows how
; to use CMPSW instruction
; to compare strings.
#make_COM#
; COM file is loaded at 100h
; prefix:
ORG 100h
; set forward direction:
CLD
; load source into DS:SI,
; load target into ES:DI:
MOV AX, CS
MOV DS, AX
MOV ES, AX
LEA si, dat1
LEA di, dat2
; set counter to data length:
MOV CX, 4
; compare until equal:
REPE CMPSW
JNZ not_equal
; "Yes" - equal!
MOV AL, 'Y'
MOV AH, 0Eh
INT 10h
JMP exit_here
not_equal:
; "No" - not equal!
MOV AL, 'N'
MOV AH, 0Eh
INT 10h
exit_here:
RET
; data:
dat1 DW 1234h, 5678h, 9012h, 3456h
dat2 DW 1234h, 5678h, 9012h, 3456h
END